package com.example.lxq.demo;

import com.example.lxq.demo.config.SpringListener;
import com.example.lxq.demo.config.SpringObserver;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class DemoApplication implements ApplicationRunner {

	private SpringListener listener;
	public static void main() {
		ConfigurableApplicationContext context=SpringApplication.run(DemoApplication.class);
		SpringObserver.context=context;
	}

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class,args);
	}

	public void start(SpringListener springListener){
		listener=springListener;
		main();
		listener.onReady();
	}

	@Override
	public void run(ApplicationArguments args) throws Exception {
		System.out.println("启动成功："+args.toString());
	}

}
